import { Env } from '../tools/env';

export function importStyle() {
  if (Env.mode === 'node') {
    return;
  }
  const styleElement = document.createElement('style');
  styleElement.id = 'vtable-sheet-formula-bar-styleSheet';
  styleElement.textContent = `
  /* 公式栏样式 */
.vtable-sheet-formula-bar {
  height: 30px;
  padding: 0;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  background-color: #fff;
  position: relative;
  z-index: 10;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  flex-grow: 1; /* 占据剩余宽度 */
  height: 100%; /* 确保高度填满父容器 */
  
}

/* 单元格地址显示 */
.vtable-sheet-cell-address {
  width: 60px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: #333;
  height: 100%;
  border: 1px solid #e0e0e0;
  font-size: 13px;
}

/* fx图标 */
.vtable-sheet-formula-icon {
  font-weight: normal;
  font-style: italic;
  margin: 0 8px;
  font-size: 14px;
  color: #666;
  font-family: 'Roboto Mono', monospace;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 公式输入框 */
.vtable-sheet-formula-input {
  flex: 1;
  padding: 0 8px;
  border: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  outline: none;
  font-size: 13px;
  height: 100%;
  color: #333;
  background-color: transparent;
}

.vtable-sheet-formula-input:focus {
  outline: none;
}

/* 公式操作按钮容器 */
.vtable-sheet-formula-actions {
  flex: 0;
  display: flex;
  align-items: right;
  height: 100%;
  width: 100px;
  padding: 0 4px;
  border-left: 1px solid #e0e0e0;
}

/* 公式操作按钮 */
.vtable-sheet-formula-button {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: #666;
  margin: 0 2px;
  padding: 0;
  border-radius: 2px;
  transition: all 0.2s;
}

/* 取消按钮 */
.vtable-sheet-formula-cancel:hover {
  color: #d93025;
  background-color: #f8f8f8;
}

/* 确认按钮 */
.vtable-sheet-formula-confirm:hover {
  color: #1e8e3e;
  background-color: #f8f8f8;
}

/* 其他按钮样式 - 当有更多功能时使用 */
.vtable-sheet-formula-more {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #666;
  margin: 0 2px;
  padding: 0;
}

.vtable-sheet-formula-more:hover {
  color: #1a73e8;
}

/* 取消之前不需要的工具栏样式 */
.vtable-sheet-toolbar,
.vtable-sheet-toolbar-group {
  display: none;
} 
`;

  document.head.appendChild(styleElement);
}
